package 面向对象初级.方法.再谈方法;

public class Method06 {
    public static void main(String[] args) {
        Method06 test = new Method06();
        int m = 10;
        int n = 20;
        //交换俩个变量的值
        //方法1
//        int temp = m;
//        m = n;
//        n = temp;
        //方法2（调用方法）
        test.swap(m,n);
    }

        public void swap(int m,int n){
            System.out.println("交换之前为："+m+" "+n);
            int temp = m;
            m = n;
            n = temp;
            System.out.println("交换之后为："+m+" "+n);
        }
    }
